package com.bp.ice.common.vo;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**佘阳
 * VO对象
 * 封装控制层要响应给客户端的数据
 */
@NoArgsConstructor
public class JsonResult implements Serializable {
    /**状态码(服务端响应到客户端的状态码)*/
    private int state=1;//1 代表ok,0代表error
    /**表示状态码对象的状态信息*/
    private String message="ok";

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    /**表示响应到客户端的具体数据*/

    private Object data;
    public JsonResult(String message){
        this.message=message;
    }
    public JsonResult(Object data) {
        this.data=data;
    }
    public JsonResult(Throwable e) {
        this.state=0;//表示异常
        this.message=e.getMessage();
    }
}
